package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;
import com.daoeping.data.Bsc_category;
import com.daoeping.domain.JsonData;
import com.daoeping.service.Bsc_categoryService;
import com.daoeping.util.ConverntJsonData;
import com.opensymphony.xwork2.ActionSupport;

public class Bsc_categoryAction extends ActionSupport{
	private Bsc_categoryService bsc_categoryService;
	private JsonData jsonData;
	private List<Bsc_category> bsc_categoryList;
	
	public List<Bsc_category> getBsc_categoryList() {
		return bsc_categoryList;
	}

	public void setBsc_categoryList(List<Bsc_category> bsc_categoryList) {
		this.bsc_categoryList = bsc_categoryList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	public Bsc_categoryService getBsc_categoryService() {
		return bsc_categoryService;
	}

	public void setBsc_categoryService(Bsc_categoryService bsc_categoryService) {
		this.bsc_categoryService = bsc_categoryService;
	}

	
	
	public  String findBsc_categoryList(){
		
		jsonData = new JsonData();
		bsc_categoryList = bsc_categoryService.findBsc_categoryList();
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_category bsc_category : bsc_categoryList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_category.getId()+"";
			strarr[0] = bsc_category.getName();
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "findBsc_categoryList";
	}
}
